package com.mofang.powerdekorhelper.adapter;

import android.content.Context;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewAdapter;
import com.mofang.powerdekorhelper.base.recycleview.BaseViewHolder;
import com.mofang.powerdekorhelper.model.MinePoint2;
import com.mofang.powerdekorhelper.utils.DateUtils;

import java.util.List;

/**
 * Created by luofei on 2016/9/26 0026.
 */
public class MinePointAdater extends BaseRecycleViewAdapter {

    public MinePointAdater(List<?> data, Context mContext, int layoutId) {
        super(data, mContext, layoutId);
    }

    @Override
    protected <T> void convert(BaseViewHolder holder, T bean, int position) {

        MinePoint2.MinePointData data = (MinePoint2.MinePointData) bean;

        holder.setText(R.id.mine_point_list_item_title, "【" + data.getType_name() + "】 " + data.getTitle());
        holder.setText(R.id.mine_point_list_item_time, DateUtils.getMin(data.getCreate_time()));
        holder.setText(R.id.mine_point_list_item_point, "+ " + data.getPoint());
    }

    public void addData(List<MinePoint2.MinePointData> minePointDatas) {
        int position = getItemCount();
        mData.addAll(minePointDatas);
        if (position == getItemCount()) {
            //数据全部加载完毕
        } else {
            notifyItemInserted(position);
        }
    }
}
